package com.dg.cuckoo.admin.action.basicInformation.permissionSettings;

import com.dg.cuckoo.admin.service.UserToJobService;
import com.dg.cuckoo.core.BaseController;
import com.dg.cuckoo.core.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 基本资料-权限设置-用户对岗位
 */
@RestController
@RequestMapping("/basicInformation/permissionSettings/userToJob")
public class UserToJob extends BaseController {

    @Autowired
    private UserToJobService service;

    /**
     * 视图显示
     */
    @PostMapping("view")
    public JsonResult<String> view(){
        String data = service.view();
        return new JsonResult<>(OK,data);
    }

    /**
     * 用户名称下拉选
     */


    /**
     * 保存
     */
    @PostMapping("save")
    public JsonResult<Void> save(String username, List<String> job){
        service.save(username,job);
        return new JsonResult<>(OK);
    }

    /**
     * 点击用户名称显示岗位
     */
    @PostMapping("openUsernameInfo")
    public JsonResult<List<String>> openUsernameInfo(String username){
        List<String> data = service.openUsernameInfo(username);
        return new JsonResult<>(OK,data);
    }



}
